import pickle
d=dict(name='Bob',age=20,score=90)
print('This is d :\n',d)
#将字典d序列化并保存到0.txt文件中
with open('0.txt','wb') as f:
	#f.write(pickle.dumps(d))
	pickle.dump(d,f)
#打开所保存的文件，进行反序列化成为字典
with open('0.txt','rb')as f1:
	#newd=pickle.loads(f1.read())
	newd=pickle.load(f1)
	print('This is newd:\n',newd)